package com.wugh.fast.security.social.app.qq.connet;

import com.wugh.fast.security.social.app.qq.api.QQApi;
import com.wugh.fast.security.social.app.qq.api.QQUserInfo;
import org.springframework.social.connect.ApiAdapter;
import org.springframework.social.connect.ConnectionValues;
import org.springframework.social.connect.UserProfile;

/**
 * @author wugh
 */
public class QQAdapter implements ApiAdapter<QQApi> {

    @Override
    public boolean test(QQApi api) {
        return true;
    }

    @Override
    public void setConnectionValues(QQApi api, ConnectionValues values) {
        QQUserInfo userInfo = api.getUserInfo();
        values.setDisplayName(userInfo.getNickname());
        values.setImageUrl(userInfo.getFigureurlQq1());
        values.setProfileUrl(null);
        values.setProviderUserId(userInfo.getOpenId());
    }

    @Override
    public UserProfile fetchUserProfile(QQApi api) {
        // TODO Auto-generated method stub
        return UserProfile.EMPTY;
    }

    @Override
    public void updateStatus(QQApi api, String message) {
        //do noting
    }

}
